using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


/// <summary>
/// The FamilyMemberRelationshipTableManager class is responsible for managing BO.FamilyMemberRelationshipTable objects in the system.
/// </summary>
    [DataObjectAttribute()]
    public class FamilyMemberRelationshipTableManager
    {

            #region "Public Methods"

            /// <summary>
            /// Gets a list with all FamilyMemberRelationshipTable objects in the database.
            /// </summary>
            /// <returns>A list with all FamilyMemberRelationshipTable from the database when the database contains any, or null otherwise.</returns>
            [DataObjectMethod(DataObjectMethodType.Select, true)]
            public static FamilyMemberRelationshipTableList GetList(){
                return FamilyMemberRelationshipTableDB.GetList();
            }

            [DataObjectMethod(DataObjectMethodType.Select, true)]
            public static FamilyMemberRelationshipTableList GetList(int UserAccountKey)
            {
                return FamilyMemberRelationshipTableDB.GetList(UserAccountKey);
            }

            /// <summary>
            /// Gets a single FamilyMemberRelationshipTable from the database without its data.
            /// </summary>
            /// <param name="relationshipID">The RelationshipID of the FamilyMemberRelationshipTable in the database.</param>
            /// <returns>A FamilyMemberRelationshipTable object when the RelationshipID exists in the database, or <see langword="null"/> otherwise.</returns>
            [DataObjectMethod(DataObjectMethodType.Select, false)]
            public static FamilyMemberRelationshipTable GetItem(int relationshipID){
                return GetItem(relationshipID, false);
            }

            [DataObjectMethod(DataObjectMethodType.Select, false)]
            public static FamilyMemberRelationshipTable GetItemByUserAccountKey(int UserAccountID)
            {
                FamilyMemberRelationshipTable myFamilyMemberRelationshipTable = FamilyMemberRelationshipTableDB.GetItemByUserAccountKey(UserAccountID);
                return myFamilyMemberRelationshipTable;
    
            }

            /// <summary>
            /// Gets a single FamilyMemberRelationshipTable from the database.
            /// </summary>
            /// <param name="relationshipID">The RelationshipID of the FamilyMemberRelationshipTable in the database.</param>
            /// <param name="getFamilyMemberRelationshipTableRecords">Determines whether to load all associated FamilyMemberRelationshipTable records as well.</param>
            /// <returns>
            /// A FamilyMemberRelationshipTable object when the RelationshipID exists in the database, or <see langword="null"/> otherwise.
            /// </returns>
            [DataObjectMethod(DataObjectMethodType.Select, false)]
            public static FamilyMemberRelationshipTable GetItem(int relationshipID, bool getFamilyMemberRelationshipTableRecords){
            FamilyMemberRelationshipTable myFamilyMemberRelationshipTable = FamilyMemberRelationshipTableDB.GetItem(relationshipID);
                return myFamilyMemberRelationshipTable;
            }

            /// <summary>
            /// Saves a FamilyMemberRelationshipTable in the database.
            /// </summary>
            /// <param name="myFamilyMemberRelationshipTable">The FamilyMemberRelationshipTable instance to save.</param>
            /// <returns>The new RelationshipID if the FamilyMemberRelationshipTable is new in the database or the existing RelationshipID when an item was updated.</returns>
            [DataObjectMethod(DataObjectMethodType.Update, true)]
            public static int Save(FamilyMemberRelationshipTable myFamilyMemberRelationshipTable){
                using (TransactionScope myTransactionScope = new TransactionScope()){
                    int familyMemberRelationshipTableRelationshipID = FamilyMemberRelationshipTableDB.Save(myFamilyMemberRelationshipTable);

                    //  Assign the FamilyMemberRelationshipTable its new (or existing RelationshipID).
                    myFamilyMemberRelationshipTable.RelationshipID = familyMemberRelationshipTableRelationshipID;

                    myTransactionScope.Complete();

                    return familyMemberRelationshipTableRelationshipID;
                }
            }

            /// <summary>
            /// Deletes a FamilyMemberRelationshipTable from the database.
            /// </summary>
            /// <param name="myFamilyMemberRelationshipTable">The FamilyMemberRelationshipTable instance to delete.</param>
            /// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
            [DataObjectMethod(DataObjectMethodType.Delete, true)]
            public static bool Delete(FamilyMemberRelationshipTable myFamilyMemberRelationshipTable){
                return FamilyMemberRelationshipTableDB.Delete(myFamilyMemberRelationshipTable.RelationshipID);
            }

            #endregion

    }

